home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / il / ilSpinLock.z / ilSpinLock
Encoding:
Text File  |  2002-10-03  |  8.4 KB  |  265 lines

  1.  
  2.  
  3.  
  4. iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))      IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll      iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk - user mode spin-lock services
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      This is a base class.
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <il/ilSpinLock.h>
  16.  
  17. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      This class is an interface to the user mode spin-lock services.
  19.  
  20. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  21.      CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  22.  
  23.           ilSpinLock(const char *name=NULL)
  24.           ilSpinLock(ilArena *arena, const char *name=NULL) _p_r_o_t_e_c_t_e_d
  25.           ilSpinLock(_u_s_p_t_r__t *_h, _c_o_n_s_t _c_h_a_r *_n_a_m_e=_N_U_L_L)     _p_r_o_t_e_c_t_e_d
  26.  
  27.      RRRRaaaacccceeee----ccccoooonnnnddddiiiittttiiiioooonnnn ffffrrrreeeeeeee ccccoooonnnnssssttttuuuuccccttttiiiioooonnnn
  28.  
  29.           static void atomicCreate(ilSpinLock*& lockp, const char *name=NULL)
  30.  
  31.      LLLLoooocccckkkkiiiinnnngggg aaaannnndddd uuuunnnnlllloooocccckkkkiiiinnnngggg
  32.  
  33.           static void lock()
  34.           static void unlock()
  35.           int set(int spins=defaultSpinCount)
  36.           int cset(int spins=defaultSpinCount)
  37.           int unset()
  38.  
  39.      QQQQuuuueeeerrrriiiieeeessss
  40.  
  41.           int isSet()
  42.           char *getName()
  43.  
  44.      MMMMoooonnnniiiittttoooorrrriiiinnnngggg
  45.  
  46.           static int monitoringLocks()
  47.           void dumpLockStats()
  48.           static void dumpLocks()
  49.  
  50.      IIIInnnniiiittttiiiiaaaalllliiiizzzzaaaattttiiiioooonnnn
  51.  
  52.           int init()
  53.           void initialize(const char *name)  _p_r_o_t_e_c_t_e_d
  54.  
  55.  
  56. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  57.      iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk(((())))
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))      IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll      iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))
  71.  
  72.  
  73.  
  74.           ilSpinLock(const char *name=NULL)
  75.           ilSpinLock(ilArena *arena, const char *name=NULL) _p_r_o_t_e_c_t_e_d
  76.           ilSpinLock(_u_s_p_t_r__t *_h, _c_o_n_s_t _c_h_a_r *_n_a_m_e=_N_U_L_L)     _p_r_o_t_e_c_t_e_d
  77.  
  78.  
  79.           Constructs a spin-lock with the descriptive name given by _n_a_m_e. The
  80.           name is only used to identify the lock for monitoring purposes.  The
  81.           second form constructs a lock in the shared-memory arena given by
  82.           _a_r_e_n_a.  The third form wraps an ilSpinLock form around the spin-lock
  83.           handle, _h.
  84.  
  85.      aaaattttoooommmmiiiiccccCCCCrrrreeeeaaaatttteeee(((())))
  86.  
  87.           static void atomicCreate(ilSpinLock*& lockp, const char *name=NULL)
  88.  
  89.  
  90.           This static method creates a spinlock "atomically" to avoid MP race
  91.           conditions.
  92.  
  93.      ccccsssseeeetttt(((())))
  94.  
  95.           int cset(int spins=defaultSpinCount)
  96.  
  97.  
  98.           This method acquires the lock conditionally. If the lock can't be
  99.           aquired in _s_p_i_n_s attempts, give up. Returns TRUE if the lock is
  100.           acquired, FALSE otherwise.
  101.  
  102.      dddduuuummmmppppLLLLoooocccckkkkSSSSttttaaaattttssss(((())))
  103.  
  104.           void dumpLockStats()
  105.  
  106.  
  107.           This method prints lock metering information.
  108.  
  109.      dddduuuummmmppppLLLLoooocccckkkkssss(((())))
  110.  
  111.           static void dumpLocks()
  112.  
  113.  
  114.           This method prints info for all locks.
  115.  
  116.      ggggeeeettttNNNNaaaammmmeeee(((())))
  117.  
  118.           char *getName()
  119.  
  120.  
  121.           This method returns the name of this lock.
  122.  
  123.      iiiinnnniiiitttt(((())))
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))      IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll      iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))
  137.  
  138.  
  139.  
  140.           int init()
  141.  
  142.  
  143.           This method re-initializes the spin-lock.
  144.  
  145.      iiiinnnniiiittttiiiiaaaalllliiiizzzzeeee(((())))
  146.  
  147.           void initialize(const char *name)  _p_r_o_t_e_c_t_e_d
  148.  
  149.  
  150.           This method implements the body of the various constructors.
  151.  
  152.      iiiissssSSSSeeeetttt(((())))
  153.  
  154.           int isSet()
  155.  
  156.  
  157.           This method returns TRUE if the lock is held by the current thread;
  158.           this is good for debugging with asserts, etc.
  159.  
  160.      lllloooocccckkkk(((())))
  161.  
  162.           static void lock()
  163.  
  164.  
  165.           This static method acquires a global spin-lock.  The global spin-
  166.           lock is atomically created. It's intended for use in initialization
  167.           code, and should not be frequently locked (i.e. once per execution
  168.           of IL for each piece of initilization code).
  169.  
  170.      mmmmoooonnnniiiittttoooorrrriiiinnnnggggLLLLoooocccckkkkssss(((())))
  171.  
  172.           static int monitoringLocks()
  173.  
  174.  
  175.           This method returns true if locks are being monitored.
  176.  
  177.      sssseeeetttt(((())))
  178.  
  179.           int set(int spins=defaultSpinCount)
  180.  
  181.  
  182.           This method attempts to acquire the lock. If the lock is
  183.           successfully acquired, this method returns TRUE, FALSE otherwise.
  184.           Every _s_p_i_n_s attempts, check to see if anyone at a higher priority is
  185.           able to run.
  186.  
  187.      uuuunnnnlllloooocccckkkk(((())))
  188.  
  189.           static void unlock()
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))      IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll      iiiillllSSSSppppiiiinnnnLLLLoooocccckkkk((((3333))))
  203.  
  204.  
  205.  
  206.           This static method releases the global spin-lock.  See the lllloooocccckkkk()
  207.           method for more details.
  208.  
  209.      uuuunnnnsssseeeetttt(((())))
  210.  
  211.           int unset()
  212.  
  213.  
  214.           This method releases the lock. This method returns TRUE if the lock
  215.           was actually released, FALSE otherwise (i.e., multiple sssseeeetttt() calls
  216.           on the same lock by the same calling thread).
  217.  
  218. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  219.      ilSemaphore(3)
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.